<?php
/**
 * <https://y.st./>
 * Copyright © 2017 Alex Yst <mailto:copyright@y.st>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <https://www.gnu.org./licenses/>.
**/

$xhtml = array(
	'<{title}>' => 'SnakeEyesCount.java',
	'<{subtitle}>' => 'Written in <span title="Programming 1">CS 1102</span> of <a href="http://www.uopeople.edu/">University of the People</a>, finalised on 2017-04-19',
	'<{copyright year}>' => '2017',
	'takedown' => '2017-11-01',
	'<{body}>' => <<<END
<h2>Source code:</h2>
<blockquote>
<pre><code>/*
 * Copyright (C) 2017 Alex Yst
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.
 */
package snakeeyescount;

/**
 *
 * @author Alex Yst
 */
public class SnakeEyesCount {
	public static void main(String[] arguments) {
		int count = 0;
		int die0;
		int die1;
		for(int i = 0;i &lt; 1000;i++) {
			do {
				count++;
				die0 = (int)(Math.random()*6)+1;
				die1 = (int)(Math.random()*6)+1;
			} while(die1 != 1 || die2 != 1);
		}
		System.out.print(((float)count)/1000 + &quot;\\n&quot;);
	}
}</code></pre>
</blockquote>
<h2>Output:</h2>
<h3>Time 0</h3>
<blockquote>
<pre>run:
38.649
BUILD SUCCESSFUL (total time: 0 seconds)</pre>
</blockquote>
<h3>Time 1</h3>
<blockquote>
<pre>run:
35.446
BUILD SUCCESSFUL (total time: 0 seconds)</pre>
</blockquote>
<h3>Time 2</h3>
<blockquote>
<pre>run:
35.604
BUILD SUCCESSFUL (total time: 0 seconds)</pre>
</blockquote>
<h3>Time 3</h3>
<blockquote>
<pre>run:
36.36
BUILD SUCCESSFUL (total time: 0 seconds)</pre>
</blockquote>
<h3>Time 4</h3>
<blockquote>
<pre>run:
36.916
BUILD SUCCESSFUL (total time: 0 seconds)</pre>
</blockquote>
END
);
